from apscheduler.schedulers.blocking import BlockingScheduler
import requests


def job_function():
    try:
        resp = requests.get('https://www.baidu.com')
        if (resp.status_code.__eq__(200)):
            print('电脑有网')
    except Exception:
        print('断网啦')

sched = BlockingScheduler()
sched.add_job(job_function, 'cron', month='6-8,11-12', hour='0-23', second='0-59')
sched.start()